﻿using System;
using HiTeachers.Services;

namespace HiTeachers.Web
{
    public partial class NewDetails : PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            var itemId = new Guid(Request["itid"]);

            var news = NewServices.GetNewById(itemId);

            if (news == null) return;

            ltrTitleNews.Text = news.Title;
            ltrPublishedDate.Text = news.CreatedDate.ToString("dd/MM/yyyy, hh:mm tt", System.Globalization.CultureInfo.InvariantCulture);
            ltrContent.Text = news.Content;

            rptOther.DataSource = NewServices.GetRelationNews(itemId, news.CreatedDate, 5);
            rptOther.DataBind();

            Page.Title = string.Format("{0} - {1}", SitePreFix, news.Title);
        }
    }
}
